{subtemplate header}
<div id="nav"><a href="$indexname">$bbname</a> &raquo; {lang task}</div>
<div id="wrap" class="wrap with_side s_clear">
	<div class="main">
		<div class="content">
		<!--{if empty($action)}-->
			<div class="itemtitle s_clear">
			<h1>{lang task}</h1>
			<ul>
				<li{if $item == 'new'} class="current"{/if}><a href="task.php?item=new" hidefocus="true"><span>{lang task_new}</span></a></li>
				<li{if $item == 'doing'} class="current"{/if}><a href="task.php?item=doing" hidefocus="true"><span>{lang task_doing}</span></a></li>
				<li{if $item == 'done'} class="current"{/if}><a href="task.php?item=done" hidefocus="true"><span>{lang task_done}</span></a></li>
				<li{if $item == 'failed'} class="current"{/if}><a href="task.php?item=failed" hidefocus="true"><span>{lang task_failed}</span></a></li>
			</ul>
			</div>
			<div class="datalist">
				<table cellspacing="0" cellpadding="0" class="datatable">
					<!--{if $tasklist}-->
						<thead class="colplural">
							<tr>
								<th></th>
								<th></th>
								<th width="200">{lang task_reward}</th>
								<th width="120"></th>
							<tr>
						</thead>
						<!--{loop $tasklist $task}-->
							<tr class="{echo swapclass('colplural')}">
								<td width="70"><img src="$task[icon]" width="64" height="64" alt="Icon" /></td>
								<td>
									<p><strong><a href="task.php?action=view&id=$task[taskid]">$task[name]</a></strong>&nbsp;&nbsp;&nbsp;( {lang task_applies}: <a href="task.php?action=view&id=$task[taskid]#parter">$task[applicants]</a> )</p>
									<p>$task[description]</p>
									<!--{if $item == 'doing'}-->
									<div class="taskbar">
										<div class="taskbar_text">{lang task_complete} <span id="csc_$task[taskid]">$task[csc]</span>%</div>
										<div class="optionbar" id="cscbar_$task[taskid]" style="width: $task[csc]%"></div>
									</div>
									<!--{/if}-->
								</td>
								<td class="emfont"><!--{if $task['reward'] == 'credit'}-->{lang credits} $extcredits[$task[prize]][title] $task[bonus] $extcredits[$task[prize]][unit]<!--{elseif $task['reward'] == 'magic'}-->{lang magics_title} $magics[$task[prize]] $task[bonus]<!--{elseif $task['reward'] == 'medal'}-->{lang medals} $medals[$task[prize]] {if $task['bonus']}{lang expire} $task[bonus] {lang days} {/if}<!--{elseif $task['reward'] == 'invite'}-->{lang invite_code} $task[prize] {lang expire} $task[bonus] {lang days}<!--{elseif $task['reward'] == 'group'}-->{lang usergroup} $groups[$task[prize]] {if $task['bonus']} $task[bonus] {lang days} {/if}<!--{/if}--></td>
								<td>
									<!--{if $item == 'new'}-->
										<!--{if $task['applyperm'] && $task['applyperm'] != 'all' && !(($task['applyperm'] == 'member' && $adminid == '0') || ($task['applyperm'] == 'admin' && $adminid > '0') || forumperm($task['applyperm']))}-->
											<a href="javascript:;" onclick="doane(event);dnotice('{lang task_group_nopermission}')"><img src="images/tasks/disallow.gif" title="{lang task_group_nopermission}" border="0" /></a>
										<!--{elseif $task['tasklimits'] && $task['achievers'] >= $task['tasklimits']}-->
											<a href="javascript:;" onclick="doane(event);dnotice('{lang task_applies_full}')"><img src="images/tasks/disallow.gif" title="{lang task_applies_full}" border="0" /></a>
										<!--{else}-->
											<a href="task.php?action=apply&id=$task[taskid]"><img src="images/tasks/apply.gif" border="0" /></a>
										<!--{/if}-->
									<!--{elseif $item == 'doing'}-->
										<p id="reward_$task[taskid]"><a href="task.php?action=draw&id=$task[taskid]" onclick="tasknoticewin('$task[taskid]');return false;"><img src="images/tasks/{if $task[csc] >= 100}reward.gif{else}rewardless.gif{/if}" border="0" /></a></p>
									<!--{elseif $item == 'done'}-->
										<p style="white-space:nowrap">{lang task_complete_on} $task[dateline]
									{if $task['period'] && $task[t]}<br />{if $task[allowapply]}<a href="task.php?action=apply&id=$task[taskid]">{lang task_applyagain_now}</a>{else}{$task[t]}{lang task_applyagain}{/if}{/if}</p>
									<!--{elseif $item == 'failed'}-->
										<p style="white-space:nowrap">{lang task_lose_on} $task[dateline]
									{if $task['period'] && $task[t]}<br />{if $task[allowapply]}<a href="task.php?action=apply&id=$task[taskid]">{lang task_applyagain_now}</a>{else}{$task[t]}{lang task_reapply}{/if}{/if}</p>
									<!--{/if}-->
								</td>
							</tr>
						<!--{/loop}-->
					<!--{else}-->
						<tr><td colspan="5"><p class="nodata"><!--{if $item == 'new'}-->{lang task_nonew}<!--{elseif $item == 'doing'}-->{lang task_nodoing}<!--{else}-->{lang data_nonexistence}<!--{/if}--></p></td></tr>
					<!--{/if}-->
				</table>
				<!--{if !empty($multipage)}--><div class="pages_btns">$multipage</div><!--{/if}-->
			</div>
		<!--{elseif $action == 'view'}-->
			<div class="itemtitle s_clear">
				<h1>{lang task_detail}</h1>
				<button class="submit right" onclick="window.location.href='task.php?item={if $task[status] == '1'}done{elseif $task[status] == '0'}doing{elseif $task[status] == '-1'}failed{else}new{/if}'">{lang return}</button>
			</div>
			<!--{if $task['endtime']}--><p class="channelinfo">{lang task_endtime}</p><!--{/if}-->
			<div class="datalist">
				<table cellpadding="0" cellspacing="0" class="datatable">
					<tr class="noborder">
						<td width="70"><img src="$task[icon]" alt="Icon" width="64" height="64" /></td>
						<td>
							<h5>$task[name]</h5>
							<!--{if $task[period]}--><p class="lighttxt">( {lang task_period} )</p><!--{/if}-->
							<p>$task[description]</p>
						</td>
					</tr>
					<tr class="noborder">
						<td></td>
						<td>
							<h5>{lang task_reward}</h5>
							<p class="emfont"><!--{if $task['reward'] == 'credit'}-->{lang credits} $extcredits[$task[prize]][title] $task[bonus] $extcredits[$task[prize]][unit]<!--{elseif $task['reward'] == 'magic'}-->{lang magics_title} $magicname $task[bonus]<!--{elseif $task['reward'] == 'medal'}-->{lang medals} $medalname {if $task['bonus']}{lang expire} $task[bonus] {lang days} {/if}<!--{elseif $task['reward'] == 'invite'}-->{lang invite_code} $task[prize] {lang expire} $task[bonus] {lang days}<!--{elseif $task['reward'] == 'group'}-->{lang usergroup} $grouptitle {if $task['bonus']} $task[bonus] {lang days} {/if}<!--{/if}--></p>
						</td>
					</tr>
					<tr class="noborder">
						<td></td>
						<td>
							<h5>{lang task_complete_condition}</h5>
							<!--{if $taskvars['complete']}-->
								<ul>
									<!--{if in_array($task['scriptname'], array('member', 'post', 'mod'))}-->
										<li>
											{lang task_complete_time_start}
											{if $taskvars[complete][time]}
												{lang task_complete_time_limit}
											{/if}
											{if $task[scriptname] == 'member'}
												{if $taskvars[complete][act][value] == 'buddy'}
													{lang task_complete_act_buddy}
												{elseif $taskvars[complete][act][value] == 'favorite'}
													{lang task_complete_act_favorite}
												{else}
													{lang task_complete_act_magic}
												{/if}
											{elseif $task[scriptname] == 'post'}
												{if $taskvars[complete][act][value] == 'newreply'}
													{if $taskvars[complete][threadid]}
														{lang task_complete_act_newreply_thread}
													{else}
														{lang task_complete_act_newreply_author}
													{/if}
												{else}
													{if $taskvars[complete][forumid]}
														{lang task_complete_forumid}
													{/if}
													{if $taskvars[complete][act][value] == 'newthread'}
														{lang task_complete_act_newthread}
													{else}
														{lang task_complete_act_newpost}
													{/if}
												{/if}
											{/if}
										</li>
									<!--{else}-->
										<!--{loop $taskvars['complete'] $taskvar}-->
											<li>$taskvar[name] : $taskvar[value]</li>
										<!--{/loop}-->
									<!--{/if}-->
								</ul>
							<!--{else}-->
								<p>{lang unlimited}</p>
							<!--{/if}-->
						</td>
					</tr>
					<tr class="noborder">
						<td></td>
						<td>
							<h5>{lang task_apply_condition}</h5>
							<!--{if $task[applyperm] || $task[relatedtaskid] || $task[tasklimits] || $taskvars['apply']}-->
								<ul>
									<li><!--{if $grouprequired}-->{lang usergroup}: $grouprequired <!--{elseif $task['applyperm'] == 'member'}-->{lang task_general_users}<!--{elseif $task['applyperm'] == 'admin'}-->{lang task_admins}<!--{/if}--></li>
									<!--{if $task[relatedtaskid]}--><li>{lang task_relatedtask}: <a href="task.php?action=view&id=$task[relatedtaskid]" class="lightlink">$taskrequired</a></li><!--{/if}-->
									<!--{if $task[tasklimits]}--><li>{lang task_numlimit}: $task[tasklimits]</li><!--{/if}-->
									<!--{if $taskvars['apply']}-->
										<!--{loop $taskvars['apply'] $taskvar}-->
											<li>$taskvar[name]: $taskvar[value]</li>
										<!--{/loop}-->
									<!--{/if}-->
								</ul>
							<!--{else}-->
								<p>{lang unlimited}</p>
							<!--{/if}-->
						</td>
					</tr>
					<tr class="noborder">
						<td></td>
						<td>
							<!--{if $allowapply == '-1'}-->
								<div class="taskbar">
									<div class="taskbar_text">{lang task_complete} <span id="csc_$task[taskid]">$task[csc]</span>%</div>
									<div class="optionbar" id="cscbar_$task[taskid]" style="width:$task[csc]%"></div>
								</div>
								<p id="reward_$task[taskid]"><a href="task.php?action=draw&id=$task[taskid]" onclick="tasknoticewin('$task[taskid]');return false;"><img src="images/tasks/{if $task[csc] >= 100}reward.gif{else}rewardless.gif{/if}" border="0" /></a></p><br /><br />
							<!--{elseif $allowapply == '-2'}-->
								<p class="notice">{lang task_group_nopermission}</p>
								<a href="javascript:;" onclick="doane(event);dnotice('{lang task_group_nopermission}')"><img src="images/tasks/disallow.gif" title="{lang task_group_nopermission}" border="0" /></a><br /><br />
							<!--{elseif $allowapply == '-3'}-->
								<p class="notice">{lang task_applies_full}</p>
								<a href="javascript:;" onclick="doane(event);dnotice('{lang task_applies_full}')"><img src="images/tasks/disallow.gif" title="{lang task_applies_full}" border="0" /></a><br /><br />
							<!--{elseif $allowapply == '-4'}-->
								<p class="notice">{lang task_lose_on}$task[dateline]</p>
							<!--{elseif $allowapply == '-5'}-->
								<p class="notice">{lang task_complete_on}$task[dateline]</p>
							<!--{elseif $allowapply == '-6'}-->
								<p class="notice">{lang task_complete_on}$task[dateline] &nbsp; {$task[t]}{lang task_applyagain}</p>
								<a href="javascript:;" onclick="doane(event);dnotice('{$task[t]}{lang task_applyagain}')"><img src="images/tasks/disallow.gif" title="{$task[t]}{lang task_applyagain}" border="0" /></a><br /><br />
							<!--{elseif $allowapply == '-7'}-->
								<p class="notice">{lang task_lose_on}$task[dateline] &nbsp; {$task[t]}{lang task_reapply}</p>
								<a href="javascript:;" onclick="doane(event);dnotice('{$task[t]}{lang task_reapply}')"><img src="images/tasks/disallow.gif" title="{$task[t]}{lang task_reapply}" border="0" /></a><br /><br />
							<!--{elseif $allowapply == '2'}-->
								<p class="notice">{lang task_complete_on}$task[dateline] &nbsp; {lang task_applyagain_now}</p>
							<!--{elseif $allowapply == '3'}-->
								<p class="notice">{lang task_lose_on}$task[dateline] &nbsp; {lang task_reapply_now}</p>
							<!--{/if}-->

							<!--{if $allowapply > '0'}-->
								<a href="task.php?action=apply&id=$task[taskid]"><img src="images/tasks/apply.gif" border="0" /></a><br /><br />
							<!--{/if}-->
						</td>
					</tr>
					<!--{if $task[applicants]}-->
					<tr>
						<td></td>
						<td>
							<a name="parter"></a>
							<div style="margin-top: 10px;">
								<div class="c_header">
									<h3 class="noarrow">{lang task_applicants}</h3>
								</div>
								<div id="ajaxparter"></div>
							</div>
							<script type="text/javascript">ajaxget('task.php?action=parter&id=$task[taskid]', 'ajaxparter');</script>
						</td>
					</tr>
					<!--{/if}-->
				</table>
			</div>
		<!--{/if}-->

		</div>
	</div>
	<div class="side">
		{subtemplate personal_navbar}
	</div>
</div>
<script type="text/javascript" reload="1">
	function tasknoticewin(taskid) {
		var x = new Ajax();
		x.get('task.php?action=draw&inajax=1&id='+taskid, function(s){
			s = s.split('|');
			csc = parseFloat(s[0]);
			s = s[1].toString();
			if(csc > 0) {
				$('csc_'+taskid).innerHTML = csc;
				$('cscbar_'+taskid).style.width = csc+'%';
				if(csc == '100') {
					$('reward_'+taskid).innerHTML = '{lang task_done}';
					noticewin(s, 10000);
				} else {
					dnotice(s);
				}
			} else {
				if(csc == '-1') $('reward_'+taskid).innerHTML = '{lang task_failed}';
				dnotice(s);
			}
		});
	}
</script>
{subtemplate footer}